import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;

import java.io.IOException;
@WebFilter("/a")
public  class MyFilter implements Filter {
    public void init(FilterConfig filterConfig)throws ServletException{
        System.out.println("过滤器init");
    }
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)throws IOException, ServletException{
        System.out.println("过滤器doFilter");

        System.out.println("MyFilter 旅行前逻辑");
        filterChain.doFilter(servletRequest,servletResponse);
        System.out.println("MyFilter 旅行后逻辑");
    }
    public void destroy(){
        System.out.println("过滤器destroy");
    }
}
